﻿/*
版权所有：版权所有(C) 2010，刘建新
文件编号：M01_BusIssueInfo.cs
文件名称：BusIssueInfo.cs
系统编号：Z0003007
系统名称：通用办公系统
模块编号：M01
模块名称：信息发布
设计文档：IOA_M01信息发布XDE建模.mdx
完成日期：2010/12/22
作　　者：
内容摘要：表[Bus_Issue_Info]对应的实体类
*/

using System;
using System.Collections;
using System.Data;


namespace Eis51.CampanyCMS.Model.BaseInfoMng
{
		/// <summary>
		/// 类 编 号：
		/// 类 名 称：BusIssueInfo
		/// 内容摘要：
		/// </summary>
		
		[Serializable]
		public class BusIssueInfo : BaseModel
		{
		#region 自动生成代码
		
			#region 重载Equals/GetHashCode
			/// <summary>
			/// 重载Equals			
			/// </summary>
			public override bool Equals (Object obj)
			{
				if (obj != null && obj is BusIssueInfo)
				{
					if (obj == this)
						return true;
					BusIssueInfo castObj = (BusIssueInfo)obj; 
					
					if (!this.m_Seqno.Equals(castObj.Seqno))
						return false;
						
					if (!this.m_InfoType.Equals(castObj.InfoType))
						return false;
						
					if (!this.m_Title.Equals(castObj.Title))
						return false;
						
					if (!this.m_Desc.Equals(castObj.Desc))
						return false;
						
					if (!this.m_Contents.Equals(castObj.Contents))
						return false;
						
					if (!this.m_Createby.Equals(castObj.Createby))
						return false;
						
					if (!this.m_Createdate.Equals(castObj.Createdate))
						return false;
						
					if (!this.m_LasteUpdateDate.Equals(castObj.LasteUpdateDate))
						return false;
						
					if (!this.m_LasteUpdateBy.Equals(castObj.LasteUpdateBy))
						return false;
						
					if (!this.m_Lcid.Equals(castObj.Lcid))
						return false;
						
					if (!this.m_Code.Equals(castObj.Code))
						return false;
						
					if (!this.m_Filename.Equals(castObj.Filename))
						return false;
						
					return true;
				}
				return false;
			}
			
			/// <summary>
			/// 重载GetHashCode
			/// </summary>
			public override int GetHashCode()
			{
					int hash = 0;					
					
					hash = hash <<  8;
					if ((object)m_Seqno != null)
					{
						hash = hash ^ m_Seqno.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_InfoType != null)
					{
						hash = hash ^ m_InfoType.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Title != null)
					{
						hash = hash ^ m_Title.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Desc != null)
					{
						hash = hash ^ m_Desc.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Contents != null)
					{
						hash = hash ^ m_Contents.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Createby != null)
					{
						hash = hash ^ m_Createby.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Createdate != null)
					{
						hash = hash ^ m_Createdate.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_LasteUpdateDate != null)
					{
						hash = hash ^ m_LasteUpdateDate.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_LasteUpdateBy != null)
					{
						hash = hash ^ m_LasteUpdateBy.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Lcid != null)
					{
						hash = hash ^ m_Lcid.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Code != null)
					{
						hash = hash ^ m_Code.GetHashCode();
					}
						
					hash = hash <<  8;
					if ((object)m_Filename != null)
					{
						hash = hash ^ m_Filename.GetHashCode();
					}
						
					return hash; 
			}
			#endregion
			
			public BusIssueInfo()
			{
				MarkNew();
			}						
			
			public BusIssueInfo GetOldValue()
			{
				return OldValue as BusIssueInfo;
			}
		
		#region Seqno属性
			private int m_Seqno = 0;
			/// <summary>
			/// 属性名称： Seqno
			/// 内容摘要： DB列名：Seqno[自动编号]
			///            DB类型：int
			/// </summary>
			public int Seqno
			{
				get
					{
						return m_Seqno;
					}
				set
					{
						if (m_Seqno as object == null || !m_Seqno.Equals(value))
						{
							m_Seqno = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region InfoType属性
			private string m_InfoType = String.Empty;
			/// <summary>
			/// 属性名称： InfoType
			/// 内容摘要： DB列名：Info_Type[1.公司简介;2.荣誉证书;3.联系我们]
			///            DB类型：string
			/// </summary>
			public string InfoType
			{
				get
					{
						return m_InfoType;
					}
				set
					{
						if (m_InfoType as object == null || !m_InfoType.Equals(value))
						{
							m_InfoType = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Title属性
			private string m_Title = String.Empty;
			/// <summary>
			/// 属性名称： Title
			/// 内容摘要： DB列名：Title[标题]
			///            DB类型：string
			/// </summary>
			public string Title
			{
				get
					{
						return m_Title;
					}
				set
					{
						if (m_Title as object == null || !m_Title.Equals(value))
						{
							m_Title = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Desc属性
			private string m_Desc = String.Empty;
			/// <summary>
			/// 属性名称： Desc
			/// 内容摘要： DB列名：Desc[简述]
			///            DB类型：string
			/// </summary>
			public string Desc
			{
				get
					{
						return m_Desc;
					}
				set
					{
						if (m_Desc as object == null || !m_Desc.Equals(value))
						{
							m_Desc = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Contents属性
			private string m_Contents = String.Empty;
			/// <summary>
			/// 属性名称： Contents
			/// 内容摘要： DB列名：Contents[内容]
			///            DB类型：string
			/// </summary>
			public string Contents
			{
				get
					{
						return m_Contents;
					}
				set
					{
						if (m_Contents as object == null || !m_Contents.Equals(value))
						{
							m_Contents = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Createby属性
			private string m_Createby = String.Empty;
			/// <summary>
			/// 属性名称： Createby
			/// 内容摘要： DB列名：CreateBy[创建人]
			///            DB类型：string
			/// </summary>
			public string Createby
			{
				get
					{
						return m_Createby;
					}
				set
					{
						if (m_Createby as object == null || !m_Createby.Equals(value))
						{
							m_Createby = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Createdate属性
			private DateTime m_Createdate = new DateTime(1900,1,1);
			/// <summary>
			/// 属性名称： Createdate
			/// 内容摘要： DB列名：CreateDate[创建时间]
			///            DB类型：DateTime
			/// </summary>
			public DateTime Createdate
			{
				get
					{
						return DateTime.Parse(m_Createdate.ToString("yyyy-MM-dd HH:mm:ss"));
					}
				set
					{
						if (m_Createdate as object == null || !m_Createdate.Equals(value))
						{
							m_Createdate = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region LasteUpdateDate属性
			private DateTime m_LasteUpdateDate = new DateTime(1900,1,1);
			/// <summary>
			/// 属性名称： LasteUpdateDate
			/// 内容摘要： DB列名：Laste_Update_Date[最后更新时间]
			///            DB类型：DateTime
			/// </summary>
			public DateTime LasteUpdateDate
			{
				get
					{
						return DateTime.Parse(m_LasteUpdateDate.ToString("yyyy-MM-dd HH:mm:ss"));
					}
				set
					{
						if (m_LasteUpdateDate as object == null || !m_LasteUpdateDate.Equals(value))
						{
							m_LasteUpdateDate = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region LasteUpdateBy属性
			private string m_LasteUpdateBy = String.Empty;
			/// <summary>
			/// 属性名称： LasteUpdateBy
			/// 内容摘要： DB列名：Laste_Update_By[最后更新人]
			///            DB类型：string
			/// </summary>
			public string LasteUpdateBy
			{
				get
					{
						return m_LasteUpdateBy;
					}
				set
					{
						if (m_LasteUpdateBy as object == null || !m_LasteUpdateBy.Equals(value))
						{
							m_LasteUpdateBy = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Lcid属性
			private int m_Lcid = 0;
			/// <summary>
			/// 属性名称： Lcid
			/// 内容摘要： DB列名：Lcid[中英文标示]
			///            DB类型：int
			/// </summary>
			public int Lcid
			{
				get
					{
						return m_Lcid;
					}
				set
					{
						if (m_Lcid as object == null || !m_Lcid.Equals(value))
						{
							m_Lcid = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Code属性
			private string m_Code = String.Empty;
			/// <summary>
			/// 属性名称： Code
			/// 内容摘要： DB列名：code[编码]
			///            DB类型：string
			/// </summary>
			public string Code
			{
				get
					{
						return m_Code;
					}
				set
					{
						if (m_Code as object == null || !m_Code.Equals(value))
						{
							m_Code = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region Filename属性
			private string m_Filename = String.Empty;
			/// <summary>
			/// 属性名称： Filename
			/// 内容摘要： DB列名：FileName[文件上传路径]
			///            DB类型：string
			/// </summary>
			public string Filename
			{
				get
					{
						return m_Filename;
					}
				set
					{
						if (m_Filename as object == null || !m_Filename.Equals(value))
						{
							m_Filename = value;
							MarkUpdated();
						}						
					}
			}
		#endregion
		
		#region static CreateDataTable/FillDataRow/DataRow2Obj/Dt2Objs/FillDataTable
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="tableName">表名</param>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(string tableName,ColumnNameEnum cne)
			{
				DataTable dtResult = new DataTable(tableName);
			
				if (cne == ColumnNameEnum.DBName)
				{
					dtResult.Columns.Add(new DataColumn("Seqno",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Info_Type",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Title",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Desc",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Contents",typeof(string)));
					dtResult.Columns.Add(new DataColumn("CreateBy",typeof(string)));
					dtResult.Columns.Add(new DataColumn("CreateDate",typeof(DateTime)));
					dtResult.Columns.Add(new DataColumn("Laste_Update_Date",typeof(DateTime)));
					dtResult.Columns.Add(new DataColumn("Laste_Update_By",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Lcid",typeof(int)));
					dtResult.Columns.Add(new DataColumn("code",typeof(string)));
					dtResult.Columns.Add(new DataColumn("FileName",typeof(string)));
				}
				else if (cne == ColumnNameEnum.PropertyName)
				{
					dtResult.Columns.Add(new DataColumn("Seqno",typeof(int)));
					dtResult.Columns.Add(new DataColumn("InfoType",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Title",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Desc",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Contents",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Createby",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Createdate",typeof(DateTime)));
					dtResult.Columns.Add(new DataColumn("LasteUpdateDate",typeof(DateTime)));
					dtResult.Columns.Add(new DataColumn("LasteUpdateBy",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Lcid",typeof(int)));
					dtResult.Columns.Add(new DataColumn("Code",typeof(string)));
					dtResult.Columns.Add(new DataColumn("Filename",typeof(string)));
				}
				return dtResult;
			}
			
			/// <summary>
			/// 得到实体对应的DataTable
			/// </summary>
			/// <param name="cne">列名映射选择:DB列名或属性名</param>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable(ColumnNameEnum cne)
			{
				return CreateDataTable(null,cne);
			}

			/// <summary>
			/// 得到实体对应的DataTable(默认列名映射为属性名)
			/// </summary>
			/// <returns>生成的DataTable</returns>
			static public DataTable CreateDataTable()
			{
				return CreateDataTable(ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			public void FillDataRow(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				if (ColumnNameEnum.DBName == cne)
				{
					dr["Seqno"] = this.Seqno;
					dr["Info_Type"] = this.InfoType;
					dr["Title"] = this.Title;
					dr["Desc"] = this.Desc;
					dr["Contents"] = this.Contents;
					dr["CreateBy"] = this.Createby;
					dr["CreateDate"] = this.Createdate;
					dr["Laste_Update_Date"] = this.LasteUpdateDate;
					dr["Laste_Update_By"] = this.LasteUpdateBy;
					dr["Lcid"] = this.Lcid;
					dr["code"] = this.Code;
					dr["FileName"] = this.Filename;
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					dr["Seqno"] = this.Seqno;
					dr["InfoType"] = this.InfoType;
					dr["Title"] = this.Title;
					dr["Desc"] = this.Desc;
					dr["Contents"] = this.Contents;
					dr["Createby"] = this.Createby;
					dr["Createdate"] = this.Createdate;
					dr["LasteUpdateDate"] = this.LasteUpdateDate;
					dr["LasteUpdateBy"] = this.LasteUpdateBy;
					dr["Lcid"] = this.Lcid;
					dr["Code"] = this.Code;
					dr["Filename"] = this.Filename;					
				}
			}
			
			/// <summary>
			/// 用当前对象值填充DaraRow(默认列名映射为属性名)
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			public void FillDataRow(DataRow dr)
			{
				this.FillDataRow(dr,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 将DataRow转换成BusIssueInfo对象
			/// </summary>
			/// <param name="dr">由CreateTable生成的DataTable通过NewRow得到的DataRow对象</param>
			/// <param name="cne">dr的列名映射方式:DB列名或属性名</param>
			/// <returns>BusIssueInfo对象</returns>
			public static BusIssueInfo Dr2Obj(DataRow dr,ColumnNameEnum cne)
			{
				if (dr == null)
				{
					throw new ArgumentNullException("dr");
				}
				BusIssueInfo obj = new BusIssueInfo();
				if (ColumnNameEnum.DBName == cne)
				{
					obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Seqno"],typeof(int));
					obj.InfoType = (dr["Info_Type"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Info_Type"],typeof(string));
					obj.Title = (dr["Title"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Title"],typeof(string));
					obj.Desc = (dr["Desc"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Desc"],typeof(string));
					obj.Contents = (dr["Contents"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Contents"],typeof(string));
					obj.Createby = (dr["CreateBy"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["CreateBy"],typeof(string));
					obj.Createdate = (dr["CreateDate"] == Convert.DBNull) ? new DateTime(1900,1,1)  : (DateTime)Convert.ChangeType(dr["CreateDate"],typeof(DateTime));
					obj.LasteUpdateDate = (dr["Laste_Update_Date"] == Convert.DBNull) ? new DateTime(1900,1,1)  : (DateTime)Convert.ChangeType(dr["Laste_Update_Date"],typeof(DateTime));
					obj.LasteUpdateBy = (dr["Laste_Update_By"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Laste_Update_By"],typeof(string));
					obj.Lcid = (dr["Lcid"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Lcid"],typeof(int));
					obj.Code = (dr["code"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["code"],typeof(string));
					obj.Filename = (dr["FileName"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["FileName"],typeof(string));
				}
				else if (ColumnNameEnum.PropertyName == cne)
				{
					obj.Seqno = (dr["Seqno"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Seqno"],typeof(int));
					obj.InfoType = (dr["InfoType"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["InfoType"],typeof(string));
					obj.Title = (dr["Title"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Title"],typeof(string));
					obj.Desc = (dr["Desc"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Desc"],typeof(string));
					obj.Contents = (dr["Contents"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Contents"],typeof(string));
					obj.Createby = (dr["Createby"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Createby"],typeof(string));
					obj.Createdate = (dr["Createdate"] == Convert.DBNull) ? new DateTime(1900,1,1)  : (DateTime)Convert.ChangeType(dr["Createdate"],typeof(DateTime));
					obj.LasteUpdateDate = (dr["LasteUpdateDate"] == Convert.DBNull) ? new DateTime(1900,1,1)  : (DateTime)Convert.ChangeType(dr["LasteUpdateDate"],typeof(DateTime));
					obj.LasteUpdateBy = (dr["LasteUpdateBy"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["LasteUpdateBy"],typeof(string));
					obj.Lcid = (dr["Lcid"] == Convert.DBNull) ? 0  : (int)Convert.ChangeType(dr["Lcid"],typeof(int));
					obj.Code = (dr["Code"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Code"],typeof(string));
					obj.Filename = (dr["Filename"] == Convert.DBNull) ? null  : (string)Convert.ChangeType(dr["Filename"],typeof(string));		
				}
				
				return obj;
			}
			
			/// <summary>
			/// 将DataRow转换成BusIssueInfo对象(默认列名映射为属性名)
			/// </summary>
			/// <returns>BusIssueInfo对象</returns>
			public static BusIssueInfo Dr2Obj(DataRow dr)
			{
				return Dr2Obj(dr,ColumnNameEnum.DBName);
			}
			
			/// <summary>
			/// 将DataTabe转换成的BusIssueInfo对象集合
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			/// <returns>BusIssueInfo对象的集合</returns>
			public static IList Dt2Objs(DataTable dt,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				
				ArrayList alResult = new ArrayList();
				
				foreach(DataRow dr in dt.Rows)
				{
					alResult.Add(Dr2Obj(dr,cne));
				}
				
				return alResult;
			}

			/// <summary>
			/// 将DataTabe转换成的BusIssueInfo对象集合(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <returns>BusIssueInfo对象的集合</returns>
			public static IList Dt2Objs(DataTable dt)
			{
				return Dt2Objs(dt,ColumnNameEnum.PropertyName);
			}
			
			/// <summary>
			/// 用objs的BusIssueInfo对象集合填充DataTable
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">BusIssueInfo对象集合</param>
			/// <param name="cne">dt的列名映射方式:DB列名或属性名</param>
			public static void FillDataTable(DataTable dt,IList objs,ColumnNameEnum cne)
			{
				if (dt == null)
				{
					throw new ArgumentNullException("dt");
				}
				if (objs == null)
				{
					throw new ArgumentNullException("objs");
				}
				
				foreach(BusIssueInfo obj in objs)
				{
					DataRow dr = dt.NewRow();
					obj.FillDataRow(dr,cne);
					dt.Rows.Add(dr);
				}
			}

			/// <summary>
			/// 用objs的BusIssueInfo对象集合填充DataTable(默认列名映射为属性名)
			/// </summary>
			/// <param name="dt">由CreateTable生成的DataTable</param>
			/// <param name="objs">BusIssueInfo对象集合</param>
			public static void FillDataTable(DataTable dt,IList objs)
			{
				FillDataTable(dt,objs,ColumnNameEnum.PropertyName);
			}
		#endregion
		
		/// <summary>
		/// 取消编辑,恢复到上次有效调用BeginEdit前的状态,并清空保留值
		/// </summary>
		public override void CancelEdit()
		{
			BusIssueInfo old = this.OldValue as BusIssueInfo;
			if (old != null)
			{
					this.Seqno = old.Seqno;
					this.InfoType = old.InfoType;
					this.Title = old.Title;
					this.Desc = old.Desc;
					this.Contents = old.Contents;
					this.Createby = old.Createby;
					this.Createdate = old.Createdate;
					this.LasteUpdateDate = old.LasteUpdateDate;
					this.LasteUpdateBy = old.LasteUpdateBy;
					this.Lcid = old.Lcid;
					this.Code = old.Code;
					this.Filename = old.Filename;				
				this.OldValue = null;
			}
		}
		
		
		
		
		#region BusIssueInfo实体的内部Key类
			/// <summary>
			/// BusIssueInfo实体的Key类
			/// </summary>
			public sealed class Key
			{
		
				private int m_Seqno;
				public int Seqno
				{
 					get 
					{ 
						 return m_Seqno; 
					}
					set 
					{ 
						m_Seqno = value;
					}
				}
		
				public Key(int pSeqno)
				{
					m_Seqno=pSeqno;

				}
			}
		#endregion
			/// <summary>
			/// 得到实体BusIssueInfo的PK
			/// </summary>
			public Key GetKey()
			{
				return new Key(Seqno);				
			}
			
				
		#endregion
	}
}
